package com.dm.wallpaper.board;

import com.dm.wallpaper.library.ResourceTable;
import com.dm.wallpaper.library.abilityPackage.WallpaperBoardApplication;
import com.dm.wallpaper.library.abilityPackage.WallpaperBoardConfiguration;
import com.dm.wallpaper.library.database.Database;
import com.dm.wallpaper.library.items.Category;
import com.dm.wallpaper.library.items.Wallpaper;

import java.util.ArrayList;
import java.util.List;

public class MyApplication extends WallpaperBoardApplication {
    @Override
    public void onInitialize() {
        super.onInitialize();
    }



    @Override
    public WallpaperBoardConfiguration onInit() {
        return new WallpaperBoardConfiguration();
    }

    @Override
    public void initData() {
        List<Wallpaper> newWallpapers = new ArrayList();

        Wallpaper wallpaperTest = Wallpaper.Builder().id(1)
                .name("测试图片")
                .author("测试作者")
                .url("https://upload-images.jianshu.io/upload_images/2159406-780cca42d54650c0.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/2159406-780cca42d54650c0.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .category("测试")
                .favorite(1)
                .color(ResourceTable.Color_blue)
                .build();


        Wallpaper wallpaperTest2 = Wallpaper.Builder().id(2)
                .name("g测试图片2")
                .author("测试作者2")
                .url("https://upload-images.jianshu.io/upload_images/14951407-08d0c4cf2d2d0c4f.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/14951407-08d0c4cf2d2d0c4f.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .category("测试2")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        Wallpaper wallpaperTest3 = Wallpaper.Builder().id(3)
                .name("1测试图片3")
                .author("测试作者3")
                .url("https://upload-images.jianshu.io/upload_images/14402665-06fdd7c4af73c76a.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/720/format/webp")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/14402665-06fdd7c4af73c76a.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/720/format/webp")
                .category("测试3")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        Wallpaper wallpaperTest4 = Wallpaper.Builder().id(4)
                .name("2测试图片4")
                .author("测试作者4")
                .url("https://upload-images.jianshu.io/upload_images/2939353-1b92eeb01b267df6.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/300/h/240")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/2939353-1b92eeb01b267df6.jpg?imageMogr2/auto-orient/strip|imageView2/1/w/300/h/240")
                .category("测试3")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        Wallpaper wallpaperTest5 = Wallpaper.Builder().id(5)
                .name("4测试图片5")
                .author("测试作者5")
                .url("https://upload-images.jianshu.io/upload_images/6332336-2a588016925ceda8.png?imageMogr2/auto-orient/strip|imageView2/1/w/300/h/240")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/6332336-2a588016925ceda8.png?imageMogr2/auto-orient/strip|imageView2/1/w/300/h/240")
                .category("测试3")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        Wallpaper wallpaperTest7 = Wallpaper.Builder().id(7)
                .name("9测试图片6")
                .author("测试作者6")
                .url("https://upload-images.jianshu.io/upload_images/1496626-d4049348e77fdc80.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/1496626-d4049348e77fdc80.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .category("测试3")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        Wallpaper wallpaperTest8 = Wallpaper.Builder().id(8)
                .name("9测试图片6")
                .author("测试作者6")
                .url("https://upload-images.jianshu.io/upload_images/1496626-d4049348e77fdc80.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/1496626-d4049348e77fdc80.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .category("测试3")
                .favorite(0)
                .color(ResourceTable.Color_blue)
                .build();

        newWallpapers.add(wallpaperTest);
        newWallpapers.add(wallpaperTest2);
        newWallpapers.add(wallpaperTest3);
        newWallpapers.add(wallpaperTest4);
        newWallpapers.add(wallpaperTest5);
        newWallpapers.add(wallpaperTest7);
        newWallpapers.add(wallpaperTest8);

        Database.get().addWallpapers(newWallpapers);

        Category category1 = Category.Builder().id(2)
                .name("测试3")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/2159406-8b196ff6c89e7c67.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .color(ResourceTable.Color_blue)
                .muzeiSelected(1)
                .selected(1)
                .build();

        Category category2 = Category.Builder().id(3)
                .name("测试2")
                .thumbUrl("https://upload-images.jianshu.io/upload_images/1496626-d4049348e77fdc80.jpg?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .muzeiSelected(1)
                .selected(1)
                .color(ResourceTable.Color_blue)
                .build();

        Category category3 = Category.Builder().id(1)
                .name("测试1")
                .muzeiSelected(1)
                .selected(1)
                .thumbUrl("https://upload-images.jianshu.io/upload_images/2159406-c0cbf9f3df6d416b.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp")
                .color(ResourceTable.Color_blue)
                .build();

        List<Category> categoryList = new ArrayList<>();
        categoryList.add(category1);
        categoryList.add(category2);
        categoryList.add(category3);
        Database.get().addCategory(categoryList);
    }
}
